Skip to content

fix: a refused launch leaves no ghost mission and is not repeated; Core reuses its own AirVPN session after a restart - #2352

Merged
Th0rgal merged 3 commits into
masterfrom
fix/unborn-mission-and-vpn-restart
Nov 30, 2026
Merged

Th0rgal merged 3 commits into
masterfrom
fix/unborn-mission-and-vpn-restart

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Problem (30 Nov)

Creating an Antigravity mission right after a Core restart answered antigravity_vpn_unavailable:airvpn_device_in_use and the mission appeared three times in the sidebar, none of them existing in Core.

  1. After a restart AirVPN still lists the previous Core process's session for the WireGuard device; Core treated it as another consumer and refused the tunnel for minutes.
  2. The refusal answered 502. orb-locald's transport (CliMain.lean ~303) retries 429/5xx writes that carry an Idempotency-Key on its three origins, and the rollback released the key: three POSTs, three missions.
  3. Each mission was inserted and announced, then deleted silently on the failed dispatch.

Specs: docs/specs/refused-launch.md (new), docs/specs/account-vpn.md.

Change

  • discardUnbornMission (one helper for every unborn-rollback site in Control.lean and McpGateway.lean) deletes the mission and emits the existing mission_deleted presentation event; the desktop removes the row on it and ignores an older list answer that still carries it.
  • Launch refusals with antigravity_* / native_* errors answer 409 with a plain message and retry_after_secs when the wait is known. A create refused after real work keeps its answer on the idempotency key for 10 s, so transport retries replay it.
  • Core records which instance and process holds each AirVPN device and may take over a session whose holder is its own dead predecessor; anything else is still refused. A VPN account whose tunnel is only waiting yields to the next usable account.

Tests

Core: TurnOutcomeTests, SelfTest, AirVpnSettingsTests, HarnessProxyTests cases. Desktop: vitest 2505 pass, tsc clean.

Not verified

  • Lean not compiled locally; CI is the first build.
  • Not run against AirVPN: assumes a new handshake on the same device replaces the listed session (otherwise the start fails closed with vpn_exit_unverified).
  • iOS and Android do not remove a row on mission_deleted yet (they refresh on it); noted in the spec.
  • The local-Core Antigravity path (Control.lean ~3203) still fails on its first account.
  • A start that cannot write the holder record now fails with vpn_coordinator_unavailable.

…ing route yields to the next account

AirVPN keeps listing a tunnel's session for a few minutes after the tunnel
is gone, so every start in that window was refused with
airvpn_device_in_use: no VPN-routed account worked for minutes after each
Core restart.

Core now records in the coordinator directory which instance and process
last started each device. A listed session may be replaced when the record
names this instance and that process is gone (Linux, pid and start time),
or names this very process. An unknown holder, the other instance or a
process that may still run keeps the refusal.

Account selection passes over an Antigravity account whose VPN route is
only waiting (device in use, coordinator busy, exit in use) and takes the
next usable account.
…and is not repeated

On 30 Nov one refused Antigravity launch left three missions in the
sidebar. The mission row and its first event reach clients before the
dispatch is admitted; the rollback deleted the row silently; the refusal
was answered 502, which orb-locald forwards to its other origins, and the
released idempotency key let each forward create another mission.

- Every unborn rollback (create, fork, /btw, MCP launch) goes through
  discardUnbornMission, which emits mission_presentation/mission_deleted.
- A create refused after real work keeps its answer on the idempotency key
  for 10 s, so a repeat gets the same refusal and does nothing; later the
  key reserves a fresh attempt.
- Account and VPN-route refusals of a launch answer 409 instead of 502, and
  a route that is only waiting is explained with retry_after_secs.
… once

The list is reconciled, never replaced, so a row that a later answer omits
stayed until two full polls missed it. mission_deleted is the explicit
removal event: the row now leaves every list on it and is kept out of a
list answer requested earlier. The composer shows Core's own explanation
of a refusal that carries retry_after_secs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant